<!--
 * @Author: 刘岩 15136056318@163.com
 * @Date: 2023-09-09 21:14:53
 * @LastEditors: 刘岩 15136056318@163.com
 * @LastEditTime: 2023-09-18 14:45:14
 * @FilePath: \yik-ui\yik-ui\comps\use-auth\index.vue
 * @Description
-->
<template>
  <Auth
    :ref="
      (e) =>
        array.push({
          ref: e,
          power: [10, 11],
        })
    "
  ></Auth>
  <div
    :ref="
      (e) =>
        array.push({
          ref: e,
          power: [20],
        })
    "
  >
    我是dom元素
  </div>
  <div ref="noArray">不通过数组实现</div>
  <button @click="handleAuth">执行权限</button>
</template>
<script setup>
import Auth from "./Auth.vue";
import { useAuth } from "hooks";
import { global } from "global";
import { ref } from "vue";
global({
  auth: [1, 2, 3, 4, 5, 6, 7, 8, 9],
});
const array = ref([]);
const noArray = ref(null);
const handleAuth = () => {
  // 第一种
  useAuth(array, {
    ref: "ref",
    power: "power",
  });
  // 第二种
  useAuth(noArray, 10);
  // 第三种
  // useAuth(noArray, [11,1]);
};
</script>
